<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>登录</title>
<link rel="stylesheet" type="text/css" href="mode/weui/weui.min.css"/>
<link rel="shortcut icon" href="favicon.ico" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<script type="text/javascript" src="js/jswx.js"></script>
<script type="text/javascript" src="js/base64-min.js"></script>
<style>
body,html{overflow:hidden;}
body{background-color:#fbf9fe}
.page_desc{text-align:center;color:#888;font-size:14px}
.hd{padding:2em 0; text-align:center}
.hd img{height:100px;width:100px;border-radius:50px}
.weui_label{width:80px;}
</style>
<script>
var temp_token='';
function initbody(){
	var msurl = location.href;
	var us=jm.base64decode(js.request('user'));
	if(!us)us=js.getoption('adminuser');
	temp_token=js.request('token');
	$('#adminuser').val(us);
	var face = js.getoption('adminface');
	if(face)get('myface').src=face;
	if(temp_token.length>=8&&us!=''){
		loginsubmit(0);
	}
	if(msurl.indexOf('#notuserid')>0){
		js.wx.alert('无法微信快捷登录，可能未关注/设置微信企业号');
	}else{
		var ptoken = js.request('ptoken');
		if(ptoken!='' && us!=''){
			$('#adminpass').val(ptoken);
			loginsubmit(0);
		}
	}
	$('#adminuser').keyup(function(e){
		if(e.keyCode==13 && this.value)$('#adminpass').focus();
	});
	$('#adminpass').keyup(function(e){
		if(e.keyCode==13 && this.value)loginsubmit(0);
	});
}
function loginsubmit(lx){
	if(js.ajaxbool)return false;
	var user = get('adminuser').value,pass = get('adminpass').value;
	if(lx==1)temp_token='';
	js.setmsg('');
	if(user==''){
		js.wx.alert('用户名不能为空', function(){get('adminuser').focus()});
		return false;
	}
	if(pass==''&&temp_token==''){
		js.wx.alert('密码不能为空', function(){get('adminpass').focus()});
		return false;
	}
	var o = get('btn0');
	o.value='登录中...';
	o.disabled=true;
	js.setoption('adminuser', user);
	js.setmsg('');
	js.ajax('login','check',{user:jm.base64encode(user),pass:jm.base64encode(pass),token:temp_token}, function(da){
		o.value='登录成功';
		loginsuccess(da);
	},'none',false, function(str){
		o.value='登录';
		o.disabled=false;
	});
	return false;
}
function loginsuccess(d){
	js.setoption('adminface', d.face);
	js.setoption('adminame',d.name);
	js.setoption('deptallname',d.deptallname);
	js.setoption('ranking',d.ranking);
	js.setoption('adminid',d.uid);
	if(js.request('ltype')=='1'){
		history.back();
	}else{
		js.location('?m=index&d=we');
	}
}
function yanzdengl(){
	js.wx.load('处理中...');
	js.location('?m=login&d=we&a=wxlogin');
}
</script>
</head>


<body>

<div class="hd">
	<div><img id="myface" onclick="location.reload()" src="images/logo.png"></div>
</div>
<div class="weui_cells weui_cells_form">
	<div class="weui_cell">
		<div class="weui_cell_hd"><label class="weui_label">用户名</label></div>
		<div class="weui_cell_bd weui_cell_primary">
			<input class="weui_input" type="text" id="adminuser" maxlength="20" placeholder="请输入用户名/姓名"/>
		</div>
	</div>
	
	<div class="weui_cell">
		<div class="weui_cell_hd"><label class="weui_label">密码</label></div>
		<div class="weui_cell_bd weui_cell_primary">
			<input class="weui_input" id="adminpass" type="password" placeholder="请输入密码"/>
		</div>
	</div>
</div>

<div class="weui_btn_area">
	<input class="weui_btn weui_btn_primary" type="button" onclick="loginsubmit(0)" value="确定" id="btn0">
</div>
<?php 
if($da['web']=='wxbro')echo '<div onclick="yanzdengl()" style="text-align:center;padding-top:10px;color:#04BE02">微信快捷登录</div>';
?>



</body>
</html>